using System.Collections.Generic;
using BasecampRestAPI;

namespace TestBasecampRestAPI.TestMoveToDoList
{
	internal class FakeToDoList : IToDoList
	{
		#region Implementation of IToDoList

		public int Id { get; set; }
		public string Name { get; set; }
		public string Description { get; set; }
		public IProject Project { get; set; }
		public IMilestone Milestone { get; set; }
		public int Position { get; set; }
		public bool Private { get; set; }
		public bool Tracked { get; set; }
		public IToDoListItem[] Items { get; set; }
		public IToDoListItem CreateItem(string content, IPerson responsibleParty, bool notify)
		{
			CreateItemCalled = true;
			CreateItemLastContent = content;
			CreateItemLastResponsibleParty = responsibleParty;
			CreateItemLastNotify = notify;
			if (_createItemFakeResultForContent.ContainsKey(content))
			{
				return _createItemFakeResultForContent[content];
			}
			return CreateItemFakeResult;
		}

		public void Delete()
		{
			DeleteCalled = true;
		}
		public bool DeleteCalled { get; private set; }

		public bool CreateItemCalled { get; private set; }
		public string CreateItemLastContent { get; private set; }
		public IPerson CreateItemLastResponsibleParty { get; private set; }
		public bool CreateItemLastNotify { get; private set; }
		public IToDoListItem CreateItemFakeResult { private get; set; }

		#endregion

		public void CreateItemFakeResultForContent(string content, IToDoListItem result)
		{
			_createItemFakeResultForContent[content] = result;
		}
		private readonly Dictionary<string, IToDoListItem> _createItemFakeResultForContent = new Dictionary<string, IToDoListItem>();
	}
}